﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace MIDIDrum
{
    public partial class SplashScreen : Form
    {
        int times = 0;
        public Form NextForm
        {
            get;
            set;
        }
        public SplashScreen()
        {
            InitializeComponent();
            NextForm = new MainForm();
        }

        public SplashScreen(bool Init)
        {
            InitializeComponent();
            if (!Init)
            {
                tmrOpacity.Enabled = false;
            }
            NextForm = new MainForm();
        }

        private void tmrOpacity_Tick(object sender, EventArgs e)
        {
            if (this.Opacity < 1)
            {
                this.Opacity += 0.01f;
            }
            else
            {
                if (times == 50)
                {
                    this.Hide();
                    NextForm.FormClosed += delegate(object s, FormClosedEventArgs ev)
                    {
                        this.Close();
                    };
                    NextForm.Show();
                    tmrOpacity.Stop();
                }
                else
                {
                    times++;
                }
            }
        }
    }
}
